﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Xml.Serialization;

namespace KQ.DCMMP.Common
{
    public static class ReflectHelper
    {
        public static object GetPropertyValue(object obj, string propertyName)
        {
            //获取字段对象
            PropertyInfo[] propertyArray = obj.GetType().GetProperties();
            if (propertyArray != null)
            {
                PropertyInfo property = propertyArray.Where(p => p.Name.Equals(propertyName)).FirstOrDefault();
                if (property != null)
                {
                    return property.GetValue(obj, null);
                }
            }

            return null;
        }
    }
}